iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 28
1

https://ithelp.ithome.com.tw/upload/images/20201010/20104220jkV6CLRxqe.png

在 Apple Actions 找到我們所需的 Actions

apple-actions/import-codesign-certs@v1
Apple-Actions/download-provisioning-profiles@v1
Apple-Actions/upload-testflight-build@master

但是上架才沒有這麼簡單啦 分兩天都有點趕

建立所需 Secrets

APPSTORE_ISSUER_ID

APPSTORE_KEY_ID

APPSTORE_PRIVATE_KEY

在此設定:https://appstoreconnect.apple.com/access/api

CERTIFICATES_P12

由鑰匙圈匯出.P12
cat XXXXX.p12 | base64 | pbcopy
貼上 Secrets 即可

CERTIFICATES_P12_PASSWORD

由鑰匙圈匯出.P12 時所設定之密碼

name: Github Actions

# on: [push, pull_request]
on:
  push:
    branches: [  Release-Store  ]
    tags:
      - 'Store*'
  pull_request:
    branches: [  Release-Store  ]
jobs:
  build:
    runs-on: macOS-latest
#    container: reactnativecommunity/react-native-android
    steps:
        
    - uses: actions/checkout@v2
    - name: Envinfo
      run: npx envinfo
   
    - name: Run a signing Certificate p12 script
      uses: apple-actions/import-codesign-certs@v1
      with: 
        p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
        p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
    - uses: Apple-Actions/download-provisioning-profiles@v1
      with:
        bundle-id: XX.XX.rn3d
        issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
        api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
        api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}

    - name: 'Another example step'
      run: echo ${{ steps.provisioning.outputs.profiles }}
   
    - name: "#️⃣ Generate Build Number"
      id: IOSbuild
      uses: einaregilsson/build-number@v2
      with:
        token: ${{ secrets.ACTION_TEST }}
        prefix: IOSbuild

    - name: "#️⃣ Generate Build Number store"
      id: IOSVERSION
      uses: einaregilsson/build-number@v2
      with:
        token: ${{ secrets.ACTION_TEST }}
        prefix: IOSVERSION
    - name: Print new build number
      run: |
        echo "Build number is $BUILD_NUMBER"
        echo "Build number is $buildnumber" ${{ steps.buildnumber.outputs.build_number }}
        echo "IOSVERSION is $buildnumber_store" ${{ steps.IOSVERSION.outputs.build_number }}
        echo "IOSbuild is $buildnumber" ${{ steps.IOSbuild.outputs.build_number }}
    - name: Install dependencies
      run: |    
        npm install -g react-native-cli
        yarn
    - name: Install IOS dependencies
      run: |    
        cd ios
        pod install
   
    - name: Build app (fix)
      run: |
        xcodebuild clean archive -workspace  ./ios/rn3d.xcworkspace -scheme rn3d -configuration Release   -archivePath ./ios/build/export.xcarchive  -showBuildTimingSummary MARKETING_VERSION=0.0.${{ steps.IOSVERSION.outputs.build_number }}  CURRENT_PROJECT_VERSION=`${{ steps.IOSbuild.outputs.build_number }}`   archive



    - name: Build IPA (APPLE)
      run: |
        xcodebuild -exportArchive -archivePath ./ios/build/export.xcarchive -exportPath ./build -exportOptionsPlist ./ios/ExportOptions.plist -allowProvisioningUpdates
 

    - uses: Apple-Actions/upload-testflight-build@master
      with:
        app-path: ./build/rn3d.ipa
        issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
        api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
        api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}

    - name: show job status 3 
      if: always()
      id: job_status
      run: echo $status
      env:
         status: ${{job.status}}

https://ithelp.ithome.com.tw/upload/images/20201011/201042204okumBqA0b.png

發佈到Apple App Store 注意事項。

配置發布方案
構建要在App Store中分發的應用程序需要使用ReleaseXcode中的方案。專為構建Release的應用程序將自動禁用應用程序內開發人員菜單,這將防止您的用戶無意間訪問生產環境中的菜單。它還將在本地捆綁JavaScript,因此您可以將應用程序放在設備上並在未連接到計算機的情況下進行測試。

要將您的應用配置為使用Release方案構建,請轉到產品→方案→編輯方案。選擇邊欄中的“運行”選項卡,然後將“構建配置”下拉列表設置為Release。

構建要發布的應用程序
現在,您可以通過點擊⌘B或從菜單欄中選擇產品→構建來構建要發布的應用程序。構建發行版後,您就可以將應用分發給Beta測試人員,並將其提交到App Store。

您還可以使用React Native CLI來通過--configuration帶有值Release(例如npx react-native run-ios --configuration Release)的選項執行此操作。


上一篇
[Day:26] GitHub Actions 懶人部署-ios 打包事前準備
下一篇
[ Day:28 ] GitHub Actions 懶人部署 - MAC OS 不能發訊息!?
系列文
ReactNative 懶人開發之路,薪水小偷練成日記(X31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言